package com.huangliusong.desigin.pattern.creational.prototype;

/**
 * @author huangliusong
 * @since 2018/10/11
 * {@link }
 */
public class Test {

    public static void main(String[] args) throws CloneNotSupportedException {
        Mail mail=new Mail();
        mail.setContent("初始化的模板");

        System.out.println("初始化mail"+mail);
        for (int i=0;i<10;i++){
            Mail mail1Temp= (Mail) mail.clone();
            mail1Temp.setName("姓名" +i);
            mail1Temp.setEmailAddress("地址"+i);
            mail1Temp.setContent("恭喜你，此次王慕课活动中奖");
            MailUtil.sendMail(mail1Temp);
            System.out.println("克隆的mail"+mail1Temp);
        }


        MailUtil.saveOriginMailRecord(mail);
    }
}
